import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:yp/config/config.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

class FilterButton extends StatelessWidget {
  final String title;
  final bool isSelected;
  final Function onTap;

  const FilterButton({
    Key key,
    @required this.title,
    @required this.isSelected,
    this.onTap,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      onTap: onTap,
      child: Container(
        width: 100.w,
        height: 48.w,
        margin: EdgeInsets.only(right: 20.w),
        decoration: BoxDecoration(
          color: isSelected
              ? Color(0xffDD8C5D).withOpacity(0.1)
              : Color(0xffF7F8FA),
          borderRadius: BorderRadius.all(
            Radius.circular(100),
          ),
        ),
        child: Center(
          child: Text(
            title,
            style: TextStyle(
              fontSize: 24.sp,
              color: isSelected ? Config.mainColor : Color(0xff555555),
            ),
          ),
        ),
      ),
    );
  }
}
